package com.atqh.logistics.controller.Request;

import com.atqh.logistics.Aop.LogAnnotation;
import com.atqh.logistics.service.CustomService;
import com.atqh.logistics.service.RequestsService;
import com.atqh.logistics.utils.Result;
import com.atqh.logistics.utils.Vo.params.CustomRegisParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @作者：大叔azhe
 * @api：详细描述
 * @创建时间：20:06 2023/4/12
 */
@RestController
@CrossOrigin
@RequestMapping("request")
@Api(tags = "申请模块")
public class RequestController {
    @Autowired
    private RequestsService requestsService;

    @ApiOperation("管理员审核司机提交的申请(同意or拒绝)")
    @RequestMapping("/shenhe")
    @LogAnnotation(module = "管理员模块", operator = "申请审核(1or0)")
    public Result ConRequest(int ReqId, int flag) {
        return requestsService.ControllerRequest(ReqId, flag);
    }

    @ApiOperation("管理员查看未处理的申请")
    @RequestMapping("ViewDai")
    @LogAnnotation(module = "管理员模块", operator = "查看未处理的申请")
    public Result ConRequest() {
        return requestsService.SelectDaiReq();
    }

    @ApiOperation("司机查看本人提交的申请")
    @RequestMapping("own")
    @LogAnnotation(module = "司机模块", operator = "查看司机本人提交的申请")
    public Result ViewOwnRequest(HttpServletRequest req) {
        return requestsService.ViewOwnRequest(req);
    }
}
